package com.dayfly.tip.interceptor;

import com.dayfly.tip.action.BaseAction;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

/**
 * 用户是否登录的拦截校验器
 * 
 * @author dayfly
 * 
 */
public class AuthInterceptor extends AbstractInterceptor {

	private static final long serialVersionUID = -1874384226726600113L;

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		if (ActionContext.getContext().getSession().get("userId") != null) {
			return invocation.invoke();
		}else{
			return BaseAction.LOGIN;
		}
	}

}
